<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script>
<script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script>

    <style>
        form {
            width: 70%;
            margin: 0 auto;
        }
        
        .ltitle {
            text-align: center;
            display: block;
            font-size: 30px;
        }
        
        .mtitle {
            text-align: center;
            display: block;
            font-size: 20px;
        }
    </style>
</head>

<body>
    <form action="/kakahair/shop/insert" method="POST" ng-app="ngApp" ng-controller="ngCtrl" enctype="multipart/form-data" onsubmit="return check()">
        <label class="ltitle">商家信息</label>
        <label>商家名称</label>
        <input type="text" name="shop.title" class="form-control shop title" />
        <label>商家内景照片</label>
        <input type="file" name="shopImg" class="form-control shopImage" />
        <label>商家最低价</label>
        <input type="text" name="shop.minPrice" class="form-control shop minPrice" />
        <label>商家平均价</label>
        <input type="text" name="shop.avePrice" class="form-control shop avePrice" />
        <label>商家详细位置</label>
        <input type="text" name="shop.local" class="form-control shop local" />
        <label>商家详细位置重复输入一边</label>
        <input type="text" name="shop.address" class="form-control shop address" />
        <label>商家电话</label>
        <input type="text" name="shop.phone" class="form-control shop phone" />
        <label>商家星级4或5</label>
        <input type="number" name="shop.star" class="form-control shop star" />
        <label>商家店面照片</label>
        <input type="file" name="shopAva" class="form-control shopAva" />
        <label>商家地区（莲池区）</label>
        <input type="text" name="shop.area" class="form-control shop area" />
        <label>商家友好值，问辛梓宁，100封顶</label>
        <input type="text" name="shop.py" class="form-control shop py" />
        <label class="ltitle">理发师信息</label>
        <label>理发师数量</label>
        <input type="number" min=0 ng-model="TechNum" />
        <div ng-repeat="tech in range(TechNum) track by $index">
            <label>照片</label>
            <input type="file" name="techPic" class="form-control technician  pic" />
            <label>姓名</label>
            <input type="text" name="technician[{{$index}}].name" class="form-control technician  name" />
            <label>职阶</label>
            <input type="text" name="technician[{{$index}}].position" class="form-control technician  position" />
            <label>从业简介</label>
            <input type="text" name="technician[{{$index}}].introduction" class="form-control technician  introduction" />
            <label>休息时间（电脑端按住Ctrl多选）</label>
            <select multiple class="form-control" name="technician[{{$index}}].restTime">
				<option class="form-control  technician  restTime" value="monday">周一</option>
				<option class="form-control  technician  restTime" value="tuesday">周二</option>
				<option class="form-control  technician  restTime" value="wednesday">周三</option>
				<option class="form-control  technician  restTime" value="thursday">周四</option>
				<option class="form-control  technician  restTime" value="friday">周五</option>
				<option class="form-control  technician  restTime" value="saturday">周六</option>
				<option class="form-control  technician  restTime" value="sunday">周日</option>
			</select>
            <label>最低价</label>
            <input type="text" name="technician[{{$index}}].minPrice" class="form-control technician  minprice" />
            <label>工作年龄</label>
            <input type="text" name="technician[{{$index}}].workAge" class="form-control technician  minprice" />
        </div>
        <label class="ltitle">服务项目</label>
        <label>洗剪吹价格</label>
        <input type="hidden" value="洗剪吹" name="bservice[0].name" />
        <input type="text" name="bservice[0].price" class="form-control bserviceBase  price" />
        <label>洗发价格</label>
        <input type="hidden" value="洗发" name="bservice[1].name" />
        <input type="text" name="bservice[1].price" class="form-control bserviceBase  price" />
        <label>造型价格</label>
        <input type="hidden" value="造型" name="bservice[2].name" />
        <input type="text" name="bservice[2].price" class="form-control bserviceBase  price" />
        <div>
            <span class="mtitle">护理项目:</span>
            <input type="hidden" value="护理" name="bservice[3].name" />
            <label>护理项目最低价:</label>
            <input type="text" name="bservice[3].price" />
            <label>护理项目数量</label>
            <input type="number" ng-model="HuNum" min='0'>
            <div ng-repeat="Hubservice in range(HuNum) track by $index">
                <label>服务名:</label>
                <input type="text" name="bservice[3].moreService[{{$index}}].name" />
                <label>服务价钱:</label>
                <input type="text" name="bservice[3].moreService[{{$index}}].price" />
            </div>
        </div>
        <div>
            <span class="mtitle">染发项目:</span>
            <input type="hidden" value="染发" name="bservice[4].name" />
            <label>染发项目最低价:</label>
            <input type="text" name="bservice[4].price" />
            <label>染发项目数量</label>
            <input type="number" ng-model="RanNum" min='0'>
            <div ng-repeat="Ranbservice in range(RanNum)  track by $index">
                <label>服务名:</label>
                <input type="text" name="bservice[4].moreService[{{$index}}].name" />
                <label>服务价钱:</label>
                <input type="text" name="bservice[4].moreService[{{$index}}].price" />
            </div>
        </div>
        <div>
            <span class="mtitle">烫发项目:</span>
            <input type="hidden" value="烫发" name="bservice[5].name" />
            <label>烫发项目最低价:</label>
            <input type="text" name="bservice[5].price" />
            <label>烫发项目数量</label>
            <input type="number" ng-model="TangNum" min='0'>
            <div ng-repeat="Tangbservice in range(TangNum) track by $index">
                <label>服务名:</label>
                <input type="text" name="bservice[5].moreService[{{$index}}].name" />
                <label>服务价钱:</label>
                <input type="text" name="bservice[5].moreService[{{$index}}].price" />
            </div>
        </div>
        <input type="submit" value="提交" />
    </form>
    <script type="text/javascript">
        var app = angular.module('ngApp', []);
        app.controller('ngCtrl', function($scope) {
            $scope.range = function(n) {
                return new Array(n);
            };
            $scope.TechNum = 3;
            $scope.HuNum = 3;
            $scope.RanNum = 3;
            $scope.TangNum = 3;
        });
        var check = function() {
            var flag = true;
            $('input').each(function() {
                if ($(this).val() == "") {
                    alert("此项不能为空");
                    $(this).focus();
                    //console.log(this);
                    $(this).val(1);
                    flag = false;
                    return false;
                }
            })
            return ture;
        }
    </script>
</body>

</html>